package com.yiyuan.app.config;

import com.guaike.core.web.helper.RequestSignHelper;
import com.yiyuan.app.helper.FileStreamConvertHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.io.InputStream;

@Component
public class BizSignConf {

    private final static String DATA_ID = "biz.sign.conf";


    @PostConstruct
    public void init() throws IOException {
        InputStream in = this.getClass().getClassLoader().getResourceAsStream(DATA_ID);
        String content = FileStreamConvertHelper.getFileContent(in);
        if (StringUtils.isNotBlank(content)) {
            // 获取缓存里的配置信息并处理
            RequestSignHelper.handle(content);
        }
    }
}
